home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
iqb9109.zip
/
QSORT.BI
< prev
next >
Wrap
Text File
|
1991-09-09
|
1KB
|
36 lines
' QSort.BI
' Declarations for QuickSort data types and procedures
CONST MaxIndex = 43
' Redefine SortType as you please. The QuickSort subprogram
' sorts on the SortType element SortKey. You can leave this
' a fixed-length string, or make it an integer, single precision, etc.
' (Any simple data type except variable-length strings).
TYPE SortType
SortKey AS STRING*5
END TYPE
' If you have other data that is not part of the key you want
' to sort by, you can add elements to the SortType user-defined
' data type to contain that data, as you can see in the commented-out
' alternate definition of SortType below.
'TYPE SortType
' SortKey AS INTEGER
' CustomerName AS STRING*30
'END TYPE
' The array below places the SortArray in a COMMON block as
' an easy way to share the array between two separate source
' modules
DIM SortArray(1 TO MaxIndex) AS SortType
COMMON SHARED /QSort/ SortArray() AS SortType
' The sorting procedures
DECLARE SUB QuickSort (Low AS INTEGER, High AS INTEGER)
DECLARE FUNCTION RandInt% (Lower AS INTEGER, Upper AS INTEGER)